<?php

namespace app\backend\controller;

use app\backend\service\MemberService;

class Member extends Backend
{
    /**
     * 用户列表
     * @param MemberService $service
     * @return string|\think\response\Json
     * @throws \think\db\exception\DbException
     */
    public function index(MemberService $service)
    {
        if ($this->request->isAjax()) {
            return $this->success($service->lists($this->request->param()));
        }
        return $this->fetch('', $service->dataLabel());
    }

    /**
     * 切换用户状态
     * @param MemberService $service
     * @return \think\response\Json
     */
    public function switch(MemberService $service)
    {
        return $this->success($service->switchState($this->request->param()));
    }
}